<!DOCTYPE html>
<html>
<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>疫情数据填报监控</title>
    <meta name="description" content="疫情数据填报监控">
    <meta name="keywords" content="疫情数据填报监控">
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../static/plugins/elementui/index.css">
    <link rel="stylesheet" href="../static/plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../static/css/style.css">
    <script src="../static/plugins/echarts/echarts.js"></script>
</head>
<body class="hold-transition">
<div id="app">
    <div class="content-header">
        <h1>数据管理<small>数据信息爬取</small></h1>
        <el-breadcrumb separator-class="el-icon-arrow-right" class="breadcrumb">
            <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>数据管理</el-breadcrumb-item>
            <el-breadcrumb-item>数据信息爬取</el-breadcrumb-item>
        </el-breadcrumb>
    </div>
    <div class="app-container">
        <div class="box" align="center">
            <el-table size="small" current-row-key="id" :data="dataList" stripe highlight-current-row style="width: 50%">
                <el-table-column type="index" align="center" label="序号"></el-table-column>
                <el-table-column prop="type" label="数据源类型" align="center"></el-table-column>
                <el-table-column label="操作" align="center">
                    <template slot-scope="scope">
                        <el-button size="mini" type="danger" @click="handleUpdate(scope.row)">更新</el-button>
                    </template>
                </el-table-column>
                <el-table-column prop="lastDate" label="最后更新时间" align="center"></el-table-column>
                <el-table-column prop="operateRole" label="最后更新角色" align="center"></el-table-column>
            </el-table>
        </div>
    </div>
</div>
</body>
<!-- 引入组件库 -->
<script src="../static/js/vue.js"></script>
<script src="../static/plugins/elementui/index.js"></script>
<script type="text/javascript" src="../static/js/jquery.min.js"></script>
<script src="../static/js/axios-0.18.0.js"></script>
<script type="text/javascript">
    var vue = new Vue({
        el: '#app',
        data: {
            queryString: null,//查询条件
            dataList: [],//当前页要展示的分页列表数据
            formData: {},//表单数据
            dialogFormVisible: false,//增加表单是否可见
            dialogFormVisible4Edit: false,//编辑表单是否可见
        },
        //钩子函数，VUE对象初始化完成后自动执行
        created() {
            this.findAll();
        },
        methods: {
            findAll() {
                axios.get("/findAllLastUpdate").then((res) => {
                    this.dataList = res.data.data;
                });
            },
            handleUpdate(row){
                this.$confirm("确定要更新到最新数据吗？", "提示", {
                    type: 'warning'
                }).then(() => {
                    //用户点击确定按钮。发送Ajax请求
                    axios.get("/updateWithSpider?id="+row.id).then((res) => {
                        if (res.data.status) {
                            this.$message({
                                message: res.data.msg,
                                type: 'success'
                            });
                            this.findAll()
                        } else {
                            //查询失败
                            this.$message.error(res.data.msg);
                        }
                    });
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '操作取消'
                    });
                });
            }
        }
    });
</script>
</html>
